package com.lanyam.travel.base.config;

import com.lanyam.travel.base.service.ICaseWithdraService;
import com.lanyam.travel.base.service.impl.CaseWithdraServiceImpl;
import com.lanyam.travel.base.utils.ApplicationContextUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * 所在包：com.lanyam.travel.base.config
 * 文件名：
 * 版权：稻草人.
 * 项目：travel
 * 功能描述：
 * 修改人：wenhe
 * 修改时间：2020-03-13 1:29
 */
@Configuration
@EnableScheduling
@Component
public class MyScheduleTask {

    @Autowired
    private ICaseWithdraService caseWithdraService;

    @Scheduled(cron = "59/59 0 1/1 * * ? ")
    //或直接指定时间间隔，例如：5秒
//    @Scheduled(fixedRate=5000)
    private void configureTasks() {
        // 扫描并插入提现入账信息
        caseWithdraService.calcCash();
        System.err.println("执行静态定时任务时间: " + caseWithdraService);
    }
}
